import  React,{Fragment} from  'react'
import  RefChild from './refChild'
export default class refs1 extends React.Component {
    constructor(props) {
        super(props);
        this.fancyButtonRef = React.createRef();
    }
    focus=()=>{
        console.log(this.fancyButtonRef)
        this.fancyButtonRef.current.focus();
    }

    render() {
        return (
            <Fragment>
                <div onClick={this.focus}>
                    点我聚焦
                </div>
                <RefChild refs={this.fancyButtonRef}>
                    123
                </RefChild>
            </Fragment>
        );
    }
}